//
//  NotesDetailOperationView.m
//  TravelFirst
//
//  Created by lanou on 15/9/20.
//  Copyright (c) 2015年 吴娅君. All rights reserved.
//

#import "NotesDetailOperationView.h"

@implementation NotesDetailOperationView

- (instancetype)initWithFrame:(CGRect)frame target:(id)target action:(SEL)action
{
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = kColor;
        
        self.favourButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self setButton:self.favourButton frame:CGRectMake(47.5, 0, 30, 30) target:target action:action tag:101 string:@"icon_great_gray_13x13@3x"];
        
        self.favourLabel = [[UILabel alloc] initWithFrame:CGRectMake(42.5, 30, 40, 15)];
        self.favourLabel.backgroundColor = [UIColor blueColor];
        [self setLabel:self.favourLabel];
        
        self.commentButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self setButton:self.commentButton frame:CGRectMake(172.5, 0, 30, 30) target:target action:action tag:102 string:@"icon_comment_gray_32x32@2x"];
        
        self.commentLabel = [[UILabel alloc] initWithFrame:CGRectMake(167.5, 30, 40, 15)];
        self.commentLabel.backgroundColor = [UIColor blueColor];
        [self setLabel:self.commentLabel];
        
        self.shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self setButton:self.shareButton frame:CGRectMake(297.5, 0, 30, 30) target:target action:action tag:103 string:@"icon_share_gray_32x32@2x"];
        
        self.shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(292.5, 30, 40, 15)];
        self.shareLabel.backgroundColor = [UIColor blueColor];
        [self setLabel:self.shareLabel];
    }
    return self;
}

- (void)setButton:(UIButton *)button frame:(CGRect)frame target:(id)target action:(SEL)action tag:(NSInteger)tag string:(NSString *)string
{
    button.frame = frame;
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [button setBackgroundImage:[UIImage imageNamed:string] forState:(UIControlStateNormal)];
    button.tag = tag;
    [self addSubview:button];
}

- (void)setLabel:(UILabel *)label
{
    label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:label];
}

@end
